add_subdirectory(usgx)

add_untrusted_library(ypc_datahub_module SHARED
  SRCS "datahub_sgx_module.cpp"
  EDL ${PROJECT_SOURCE_DIR}/toolkit/datahub/enclave/datahub_enclave.edl
  EDL_SEARCH_PATHS ${PROJECT_SOURCE_DIR}/core/edl/:${PROJECT_SOURCE_DIR}/stbox/src/)
install(TARGETS ypc_datahub_module DESTINATION lib)

add_untrusted_library(ypc_parser_module SHARED
  SRCS "parser_sgx_module.cpp"
  EDL ${PROJECT_SOURCE_DIR}/core/edl/eparser.edl
  EDL_SEARCH_PATHS ${PROJECT_SOURCE_DIR}/core/edl/:${PROJECT_SOURCE_DIR}/stbox/src/:${PROJECT_SOURCE_DIR}/stbox/src/tsgx/crypto/)
install(TARGETS ypc_parser_module DESTINATION lib)

target_link_libraries(ypc_datahub_module stbox_common_u)

if (${ENABLE_DIANSHU})
  set(ypc_usgx dshttp_request)
else()
  set(ypc_usgx ypc_usgx)
endif()
target_link_libraries(ypc_parser_module stbox_common_u ${ypc_usgx})
